import request from '@/utils/request'
import qs from 'qs'

/**
 * 获取上传参数
 * @returns {*}
 */
export const getParameterList = (data) => {
  return request({
    url: '/parameter/getParameterList.do',
    method: 'POST',
    data: qs.stringify(data),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
  })
}

/**
 * 根据条件搜索：检测isPort为1的情况下调用的接口地址
 * @param url
 * @param {*} url
 * @returns
 */
export const getIsPortIsOneList = (url) => {
  return request({
    url,
    method: 'GET',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
  })
}

/**
 * 获取数据上传文件信息表
 * @returns {*}
 */
export const getUpdateInfoList = (apiUrl, data) => {
  return request({
    url: `/${apiUrl}`,
    method: 'POST',
    data: qs.stringify(data),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
  })
}

/**
 * 数据导入——保存入库
 * @returns {*}
 */
export const importSave = (data) => {
  return request({
    url: '/reportUpload/importSave.do',
    method: 'POST',
    data: data,
    headers: { 'Content-Type': 'multipart/form-data;boundary=---011090910111098901101801' }
  })
}

/**
 * 撤销任务
 * @returns {*}
 */
export const deleteUpdateinfoData = (data) => {
  return request({
    url: '/reportUpload/deleteUpdateinfoData.do',
    method: 'POST',
    data: qs.stringify(data),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
  })
}

/**
 * 获取任务关联数据信息
 * @returns {*}
 */
export const getTaskReportData = (data) => {
  return request({
    url: '/reportUpload/getTaskReportData.do',
    method: 'POST',
    data: qs.stringify(data),
    headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
  })
}
